import csv
import pandas as pd

df_city = pd.read_csv(r"D:\py\pythonProject\population-data\data\temp\分省城镇人口数据.csv",encoding="gbk")
df_all  = pd.read_csv(r"D:\py\pythonProject\population-data\data\temp\分省常驻人口数据.csv",encoding="gbk")

df_fin=df_city.copy()
df_fin.iloc[:,2:]=df_city.iloc[:,2:].div(df_all.iloc[:,2:],axis=1)
df_fin.iloc[:, 2:] = df_fin.iloc[:, 2:].applymap(lambda x: round(x * 100, 2))
#print(df_fin.iloc[:,2:])
#df_fin.to_csv(r"D:\py\pythonProject\population-data\data\temp\分省城镇率数据.csv",encoding="gbk",index=False)